package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HomeController {
/*

    @RequestMapping("/index")
    public ModelAndView index(){
        ModelAndView mav = new ModelAndView();
        mav.setViewName("index");
        mav.addObject("msg", "index method");
        return mav;
    }
*/

   /* @RequestMapping(value={"/index2","index3"})
    public ModelAndView index2And3(){
        System.out.println("2 and 3");
        ModelAndView mav = new ModelAndView();
        mav.setViewName("index");
        mav.addObject("msg", "index method");
        return mav;
    }*/

   /* @RequestMapping(value="*")
    public ModelAndView all(){
        System.out.println("没有严格对应的方法时都来这里");
        ModelAndView mav = new ModelAndView();
        mav.setViewName("index");
        mav.addObject("msg", "index method");
        return mav;
    }*/

    /**
     * ant地址风格：
     * 3个通配符
     * ？指代一个符号
     * * 指代一个路径段
     * ** 指代任意段
     * 例如：a/ima?e.png  ---a/image.png a/imae.png
     * 星号，例如，a/ * /abc.png --->a/asa/abc.png  a/b/abc.png
     * 双星号，例如 a/ ** /1.jpg-- >a/a/1.jpg,a/abc/1.jpg, a/a/ab/cdef/1.jpg
     *
     * @return
     */
    @RequestMapping(value = "/product/**/*.jpg")
    public ModelAndView antPathMatch() {
        System.out.println("ant (蚂蚁）");
        ModelAndView mav = new ModelAndView();
        mav.setViewName("index");
        mav.addObject("msg", "index method");
        return mav;
    }

}
